from Tools import Tools

def show(title):
    cf = Tools.Config("config.ini")
    Tools.logger().success(cf.get_config("Test", "name"))
    Tools.FileOp.mkdir("data")
    Tools.FileOp.deldir("data")
    Tools.FileOp.get_totalsize("data")
    Tools.logger().success(Tools.get_date())
    print(Tools.codelist())
    print(Tools.NetAPI.get_data("sz000001"))
    ts = Tools.DB.get_engine_ts("root", "123456", "127.0.0.1:3306", "tdx", False)
    print(ts.execute("show databases"))
    liststr=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]

    xxx = Tools.fd_data(liststr,5)
if __name__ == '__main__':
    Tools.logger().critical("start..")
    Tools.running(runfunc=show)



import threading
import time
def job():
    print("这是一个需要执行的任务。。。。。")
    print("当前线程的个数:", threading.active_count() )
    print("当前线程的信息:", threading.current_thread())
    time.sleep(1)
if __name__ == '__main__':
    # 创建多线程时， 需要制定该线程执行的任务.name线程名字 target目标函数名
    t1 = threading.Thread(target=job,name='job1')
    t2 = threading.Thread(target=job,name='job2')
    t1.start()
    t2.start()
    print(threading.active_count())
    # 出现的问题: 主线程执行结束， 但是子线程还在运行。
    # 等待所有的子线程执行结束之后， 再执行主线程
    t1.join()
    t2.join()
    print("程序执行结束.....")